﻿@using NewLife.Common;
@using NewLife.Cube
@using NewLife.Cube.WebMiddleware
@{
    var set = NewLife.Cube.Setting.Current;
    var res = set.ResourceUrl;
    if (String.IsNullOrEmpty(res)) res = "/Content";
    res = res.TrimEnd('/');

    var runInfo = !set.ShowRunTime ? "" : RunTimeMiddleware.GetInfo(this.Context);
}
<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8" />
    <title>@SysConfig.Current.DisplayName</title>
    <meta name="description" content="@SysConfig.Current.Company" />
    <meta name="keywords" content="@SysConfig.Current.Company" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="shortcut icon" href="~/favicon.ico" />
    <!-- 自定义样式 -->
    @RenderSection("css", required: false)
    <!-- 核心脚本 -->
    <link rel="stylesheet" href="~/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="~/style/admin.css" media="all">
    <!-- JQuery作为一等公民，页面内部随时可能使用 -->
    <script src="@res/js/jquery-2.1.3.min.js"></script>
    <!-- 全局脚本 -->
    <script src="~/layui/layui.js"></script>

</head>
<!--begin::Body-->
<body class="layui-layout-body">
    @RenderBody()
    @if (set.ShowRunTime)
    {
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">运行数据</div>
                        <div class="layui-card-body">
                            <blockquote class="layui-elem-quote layui-quote-nm">@Html.Raw(runInfo)</blockquote>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    }
    <!----------------------------------------以下为Javascript脚本区域----------------------------------------------------------------->
    <script>
        layui.config({
            base: '../../../' //静态资源所在路径
        }).extend({
            index: '../../../lib/index' //主入口模块
        }).use(['index', 'table', "laydate", "dropdown", "form", "upload", 'treeTable', 'util', 'xmSelect', 'notice', 'jquery', 'tagsInput', 'excel', 'soulTable', 'cron'], function () {
            var admin = layui.admin
                , table = layui.table
                , soulTable = layui.soulTable
                , laydate = layui.laydate
                , dropdown = layui.dropdown
                , layer = layui.layer
                , form = layui.form
                , upload = layui.upload
                , treeTable = layui.treeTable
                , util = layui.util
                , xmSelect = layui.xmSelect
                , notice = layui.notice
                , $ = layui.jquery
                , laytpl = layui.laytpl
                , tagsInput = layui.tagsInput
                , excel = layui.excel
                , cron = layui.cron
                , slider = layui.slider;
        @RenderSection("layuiscripts", required: false)
                form.render(null, 'component-form-group');

            laydate.render({
                elem: '#LAY-component-form-group-date'
            });

            //form.on('radio(choiceradio)', function(data){
            //    $("input[lay-filter=choiceradio]").attr("checked",false);
            //    $("input[lay-filter=choiceradio][value="+data.value+"]").attr("checked", true);
            //    $("input[type=hidden][lay-filter=choiceradio]").val(data.value);
            //});

            /* 自定义验证规则 */
            form.verify({
                name: [/^[a-zA-Z][a-zA-Z0-9_]{5,20}$/, '用户名以字母开头，要求5-20位且包含字母数字下划线']
                , pass: [/(.+){8,20}$/, '密码太弱，要求8-20位且包含数字大小写字母和符号']
                , content: function (value) {
                    layedit.sync(editIndex);
                }
            });


            //主题设置
            form.on("switch(header-theme-mode)", function (e) {
                var isdark = e.elem.checked;
                var msgBox;
                if (isdark) {
                    msgBox = layer.msg("\u5df2\u8bbe\u7f6e\u6df1\u8272\u6a21\u5f0f<br>\u5982\u9700\u6700\u4f73\u6548\u679c\uff0c\u5efa\u8bae\u5207\u6362\u660e\u4eae\u6a21\u5f0f", {
                        offset: "24px",
                        time: 5e3,
                        anim: "slideDown",
                        isOutAnim: !1
                    });
                    layui.data("layui", {
                        key: "themeMode",
                        value: "dark"
                    });
                } else {
                    layui.data("layui", {
                        key: "themeMode",
                        value: ""
                    });
                }
            });


            setDark();

            //主题定时设置
            setInterval(setDark, 1000);

            function setDark() {
                var themeMode = layui.data("layui").themeMode;
                if ("dark" === themeMode) {
                    layui.link("/layui/css/modules/layui-theme-dark/layui-theme-dark.css", null, "theme-dark");
                }
                else {
                    $("#layuicss-theme-dark").remove();
                }
                $("#ID-header-theme-mode").prop("checked", "dark" === themeMode);

                form.render("checkbox");
            }
        });


        function stringJson(formid) {
            var formdata = $(formid).serializeArray();
            var data = {};
            $(formdata).each(function (index, obj) {
                data[obj.name] = obj.value;
            });
            return data;
        }
    </script>
    <!--自定义脚本-->
    @RenderSection("scripts", required: false)
</body>
<!--end::Body-->
<style>
    .layui-nav * {
        margin-bottom: 6px;
    }
</style>
</html>